﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Controller;
using Model;


namespace Trabajador
{
    public partial class LoginWindow : Form
    {
        UserController pMan;
        public LoginWindow()
        {
            pMan = new UserController();
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Usuario user = new Usuario(txtUser.Text, txtPass.Text);
            if (pMan.validCredentials(user))
            {
                this.DialogResult = DialogResult.OK;
            }
            else
            {
                MessageBox.Show("Usuario o password incorrecto","Error");
            }

        }

        private void button2_Click(object sender, EventArgs e)
        {
            forgotpassword fg = new forgotpassword();
            fg.Show();
        }
    }
}
